/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package ru.jSkyRoom.bridge.major;

import ru.jSkyRoom.interfaces.major.GlobalForm;
import ru.jSkyRoom.support.GlobalFormFlag;
import static ru.jSkyRoom.support.GlobalFormFlag.CONSTANT;
import skyproc.GLOB;
import skyproc.MajorRecord;

/**
 *
 * @author Rakev
 */
public class GlobalFormBridge extends MajorBridge<GLOB> implements GlobalForm {

    public GlobalFormBridge(GLOB adapting) {
        super(adapting);
    }

    @Override
    public GLOB.GLOBType getGlobalType() {
        return getRawObject().getGLOBType();
    }

    @Override
    public void setGlobalType(GLOB.GLOBType type) {
        getRawObject().setType(type);
    }

    @Override
    public float getValue() {
        return getRawObject().getValue();
    }

    @Override
    public void setValue(float value) {
        getRawObject().setValue((float) value);
    }

    @Override
    public boolean getFlag(GlobalFormFlag flag) {
        switch (flag) {
            case CONSTANT:
                return getRawObject().isConstant();
            default:
                throw new UnsupportedOperationException("Unsupported flag: " + flag);
        }
    }

    @Override
    public void setFlag(GlobalFormFlag flag) {
        switch (flag) {
            case CONSTANT:
                getRawObject().setConstant(true);
                break;
            default:
                throw new UnsupportedOperationException("Unsupported flag: " + flag);
        }
    }

    @Override
    public void unsetFlag(GlobalFormFlag flag) {
        switch (flag) {
            case CONSTANT:
                getRawObject().setConstant(false);
                break;
            default:
                throw new UnsupportedOperationException("Unsupported flag: " + flag);
        }
    }
}
